package cn.huas.sqls;
public class Recover { 
public boolean load(String database,String filepath){
	 // String filepath = "d:\\test.sql"; // 备份的路径地址  
	  //新建数据库test 
	  String stmt0 ="cmd.exe /c \""+ "mysqladmin -u root -padmin dorp database "+database; 
	  String stmt1 ="cmd.exe /c \""+ "mysqladmin -u root -padmin create "+database; 
	  String stmt2 = "cmd.exe /c \""+"mysql -u root -padmin " +database+"< " + filepath; 
	  try { 
      Runtime.getRuntime().exec(stmt0); 
	  Runtime.getRuntime().exec(stmt1); 
	  Runtime.getRuntime().exec(stmt2); 
	  System.out.println("数据已从 " + filepath + " 导入到数据库中"); 
	  } catch (Exception e) { 
	  e.printStackTrace(); 
	  } 
	  return true; 
}
//public static void main(String[] args) {
//	Recover rec=new Recover();
//	rec.load();
//}
}